/******************************************************************************
 * Copyright (C) 2024 EternalChip, Inc.(Gmbh) or its affiliates.
 * 
 * All Rights Reserved.
 * 
 * @file bsp_led_driver.c
 * 
 * @par dependencies 
 * - bsp_led_driver.h
 * - stdint.h
 * 
 * @author rnz | zjut
 * 
 * @brief Provide the  APIs of LEDs and corresponding opetions.
 * 
 * Processing flow:
 * 
 * call directly.
 * 
 * @version V1.0 2025-5-7
 *
 * @note 1 tab == 4 spaces!
 * 
 *****************************************************************************/

//******************************** Includes *********************************//
#include "bsp_led_driver.h"

//******************************** Includes *********************************//

//******************************** Defines **********************************//
/**
 * @brief Instantiates the target of bsp_led_driver_t.
 * 
 * Steps:
 *  1. Adds the Core interfaces into bsp_led_driver instance.
 *  2. Adds the Os interfaces into bsp_led_driver instance.
 *  3. Adds the timebase interfaces into bsp_led_driver instance.
 *  
 * @param[in] self         : Pointer to the target of handler.
 * @param[in] led_ops      : Pointer to the os_delay_interface.
 * @param[in] os_delay     : Pointer to the os_queue_interface.
 * @param[in] time_base    : Pointer to the os_critical_interface.
 * 
 * @return led_status_t : Status of running.
 * 
 * */
led_status_t led_driver_inst (
                          bsp_led_driver_t        *  const       self,
                          const led_operations_t  *  const    led_ops,
                          const os_delay_t        *  const   os_delay,
                          const time_base_ms_t    *  const  time_base)
{
    led_status_t ret = LED_OK;
    DEBUG_OUT("led inst start\r\n");

    if(  NULL == self      ||
         NULL == led_ops   ||
         NULL == os_delay  ||
         NULL == time_base  )
    {
#ifdef DEBUG
        DEBUG_OUT("LED_ERRORPARAMETER\r\n");
        return LED_ERRORPARAMETER;
#endif //DEBUG
    }

    if( INITED == self->is_inited )
    {    
#ifdef DEBUG
        DEBUG_OUT("LED_ERRORRESOURCE\r\n");
        return LED_ERRORRESOURCE;
#endif //DEBUG
    }
#ifdef DEBUG
    DEBUG_OUT("led_driver_inst\r\n");
#endif //DEBUG
    return ret;
}
//******************************** Defines **********************************//
//******************************** Declaring ********************************//
